//
//  LogInController.h
//  ios_51job
//
//  Created by kai ren on 28/09/2011.
//  Copyright 2011 none. All rights reserved.
//

#import <UIKit/UIKit.h>
#import "WeiboBase.h"
#import "ACGlobal.h"

//-------------------------------------------------------------------------------

@protocol LogInControllerDelegate

@optional

- (void)LogInSucceeded:(NSMutableDictionary *)_info;

- (void)LogInCancel;

@end

//-------------------------------------------------------------------------------

@interface LogInController : UIViewController <UIWebViewDelegate>{
	UIWebView *verifyWebView;
	
	NSMutableData *_data;
	NSMutableDictionary *OAuthInfo;
	
	NSURLConnection *conToken;
	NSURLConnection *conAccessToken;
	
	NSObject<LogInControllerDelegate> *delegate;
	
	NSString *verifyUrl;
	NSString *tokenUrl;
	NSString *accessUrl;
	NSString *cacheName;
	NSString *appKey;
	NSString *appSecret;
}

@property (retain) NSMutableDictionary *OAuthInfo;
@property (retain) NSURLConnection *conToken;
@property (retain) NSURLConnection *conAccessToken;
@property (assign) NSObject<LogInControllerDelegate> *delegate;

- (id)initWithDeleget:(NSObject<LogInControllerDelegate> *)object;

//Parse TokenKey with weibo api Response
- (void)parseTokenKeyWithResponse:(NSString *)Response;

//Get tonkenKey
- (void)getTonkenKey;

//Write OAuth info to document folder
- (void)WriteOAuthInfo;

//Cancel button action
- (void)Cancel;

/** Reset the received data **/
- (void)resetData;

@end
